{extend name="layouts:layout"/}

{block name="content"}
<style>
    .nav-tabs>li>a {
        color: #999;
        font-weight: 500;
        padding: 6px 18px 6px 20px;
    }
    .nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus{
        color: #000;
    }
</style>
<div class="mt10" style="background-color: #fff;padding: 10px">
    {notempty name="lists"}
        <div class="bs-example bs-example-tabs" data-example-id="togglable-tabs">
            <ul class="nav nav-tabs" role="tablist">
                {foreach $lists as $groupKey=>$groups}
                    <li role="presentation"><a href="#{$groupKey}" id="{$groupKey}-tab" role="tab" data-toggle="tab" aria-controls="{$groupKey}" aria-expanded="true">{$groups.title}</a></li>
                {/foreach}
            </ul>
            <div class="tab-content mt20">
                {foreach $lists as $groupKey=>$groups}
                    <div role="tabpanel" class="tab-pane " id="{$groupKey}" aria-labelledby="{$groupKey}-tab">
                        {notempty name="groups.chList"}
                            <form class="form-horizontal" id="form-config-site-{$groupKey}">
                                {foreach $groups['chList'] as $input}
                                    {eq name="input.style" value="text"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$input.title}：</label>
                                            <div class="col-sm-8">
                                                <input type="text" name="{$input.id}" value="{$input.value}" class="form-control" autocomplete="off">
                                                {notempty name="input.note"}
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$input.note}</span>
                                                {/notempty}
                                            </div>
                                        </div>
                                    {/eq}
                                    {eq name="input.style" value="textarea"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$input.title}：</label>
                                            <div class="col-sm-8">
                                                <textarea rows="3" name="{$input.id}" class="form-control" >{$input.value}</textarea>
                                                {notempty name="input.note"}
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$input.note}</span>
                                                {/notempty}
                                            </div>
                                        </div>
                                    {/eq}
                                    {eq name="input.style" value="select"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$input.title}：</label>
                                            <div class="col-sm-8">
                                                <select name="{$input.id}" class="form-control">
                                                    {foreach $input['extra'] as $ikey=>$ival}
                                                        <option value="{$ikey}" {eq name="ikey" value="$input['value']"}selected{/eq}>{$ival}</option>
                                                    {/foreach}
                                                </select>
                                                {notempty name="input.note"}
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$input.note}</span>
                                                {/notempty}
                                            </div>
                                        </div>
                                    {/eq}
                                    {eq name="input.style" value="array"}
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">{$input.title}：</label>
                                            <div class="col-sm-8">
                                                <textarea rows="5" name="{$input.id}" class="form-control" >{$input.value}</textarea>
                                                {notempty name="input.note"}
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> {$input.note}</span>
                                                {/notempty}
                                            </div>
                                        </div>
                                    {/eq}
                                {/foreach}
                                <div class="form-group text-center mt20">
                                    <a href="javascript:;" class="btn btn-success btn-mid b5submit_btn" data-target="form-config-site-{$groupKey}" data-title="确定提交网站配置信息">保存</a>
                                </div>
                            </form>
                        {/notempty}
                    </div>
                {/foreach}
            </div>
        </div>
    {/notempty}
</div>
{/block}

{block name="script"}
<script>
    $(function (){
        $(".nav-tabs li:first").addClass('active')
        $(".tab-content .tab-pane:first").addClass('active')
    })
</script>
{/block}
